package class41To50;

import java.io.*;
import java.util.Arrays;

public class DiffMatrix {

    public static int MAX_N = 1010;

    public static int MAX_M = 1010;

    public static int n;

    public static int m;

    public static int q;

    public static int[][] diff = new int[MAX_N][MAX_M];

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
//        while (in.nextToken() != StreamTokenizer.TT_EOF) {
//            n = (int) in.nval;
//            in.nextToken();
//            m = (int) in.nval;
//            in.nextToken();
//            q = (int) in.nval;
//            for (int i = 1; i <= n; i++) {
//                for (int j = 1; j <= m; j++) {
//                    in.nextToken();
//                    add(i, j, i, j, (int) in.nval);
//                }
//            }
//            for (int i = 1, a, b, c, d, k; i <= m; i++) {
//                in.nextToken();
//                a = (int) in.nval;
//                in.nextToken();
//                b = (int) in.nval;
//                in.nextToken();
//                c = (int) in.nval;
//                in.nextToken();
//                d = (int) in.nval;
//                in.nextToken();
//                k = (int) in.nval;
//                add(a, b, c, d, k);
//            }
//            build();
//            for (int i = 1; i <= n; i++) {
//                out.print(diff[i][1]);
//                for (int j = 2; j <= m; j++) {
//                    out.print(" " + diff[i][j]);
//                }
//                out.println();
//            }
//            clear();
//        }
        in.nextToken();
        n = (int) in.nval;
        in.nextToken();
        m = (int) in.nval;
        //in.nextToken();
        //q = (int) in.nval;
//        for (int i = 1; i <= n; i++) {
//            for (int j = 1; j <= m; j++) {
//                in.nextToken();
//                int val = (int) in.nval;
//                add(i, j, i, j, val);
//                //out.print(diff[]);
//            }
//        }
        for (int i = 0; i < m; i++) {
            in.nextToken();
            int a = (int) in.nval;
            in.nextToken();
            int b = (int) in.nval;
            in.nextToken();
            int c = (int) in.nval;
            in.nextToken();
            int d = (int) in.nval;
//            in.nextToken();
//            int k = (int) in.nval;
//            out.println(a + " " + b + " " + c + " " + d + " " + 1);
            add(a, b, c, d, 1);
        }
        build();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                out.print(diff[i][j] + " ");
            }
            out.println();
        }
        clear();
        out.flush();
        out.close();
        br.close();
    }

    public static void add(int a, int b, int c, int d, int val) {
        diff[a][b] += val;
        diff[c + 1][b] -= val;
        diff[a][d + 1] -= val;
        diff[c + 1][d + 1] += val;
    }

    public static void build() {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                diff[i][j] += diff[i - 1][j] + diff[i][j - 1] - diff[i - 1][j - 1];
            }
        }
    }

    public static void clear() {
        for (int i = 0; i <= n + 1; i++) {
            for (int j = 0; j <= n + 1; j++) {
                diff[i][j] = 0;
            }
        }
    }
}
